home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
ab20
/
ab20_archive
/
datacomm
/
vltjr-5.045.lzh
/
rexx
/
AutoWrap.vlt
< prev
next >
Wrap
Text File
|
1991-01-03
|
1KB
|
66 lines
/** AutoWrap.vlt
*
* Example program to intercept keystrokes.
* This one implements automatic wrapping.
*
**/
margincol = 72
/*
* Open a port
*/
mp = openport(MARGIN_BELL)
/*
* Tell VLT to send us stuff
*/
"wedge keystrokes MARGIN_BELL"
/*
* Loop until quitflag is 1, waiting for packets
*/
do forever
if quitflag = 1 then leave
t = waitpkt(MARGIN_BELL)
/*
* We got a number of packets. Loop over all of them.
*/
do ff = 1
p = getpkt(MARGIN_BELL)
if c2d(p) = 0 then leave ff
line = getarg(p)
/*
* Got something. Find out what...
*/
parse var line command code qual iaddr char .
/*
* If we got an "esc", quit.
*/
if char = '1B'x then do
quitflag = 1
"$1: BEEP; delay .7; BEEP; delay .7; BEEP"
end
/*
* Else check the current cursor x position. Send VLT a BEEP command if it
* is at the margin column.
*/
else do
"extract x"
if VLT.x = margincol then do
"extract reviewlineatcursor"
s = reverse(VLT.reviewlineatcursor)
n = index(s, " ")
if n > 0 then do
"send ("copies('08'x, n)")"
"emit ("copies('08'x, n)")"
if n > 1 then do
"send (*R"reverse(substr(s, 1, n - 1))")"
"emit (*R"reverse(substr(s, 1, n - 1))")"
end
end
end
end
t = reply(p, 1)
end
end
call PostMsg()